3. Using Windows PowerShell During the Upgrade Process
The following sections
provide information about some Windows PowerShell commands you might
find useful during an upgrade.
3.1. Preparing for an Upgrade
After installing SharePoint
2010 and before upgrading, you can use the Test-SPContentDatabase
cmdlet to check your SharePoint Server 2007 databases for current or
potential issues, such as orphan data, missing site definitions,
missing features, or missing assemblies.
Checking for these issues does not disrupt your SharePoint
installation, and this cmdlet can also test the status of SharePoint
2010 databases, which can assist you in maintaining the continued
health of your environment. The following example shows the command and
its sample output.
Test-SPContentDatabase -name W_intranet -WebApplication http://www.contoso.msft
Category : SiteOrphan
Error : True
UpgradeBlocking : False
Message : Database [W_intranet] contains a site (Id = [46ad6d70-9a5c-4d
e0-8daa-0f73f2466a6a], Url = [/]) whose id is already associa
ted with a different database (Id = [6987d2d8-6291-4ead-9eb0-
aefe7097a58e], name = [W_Intranet]) in the site map. Consider
deleting one of these sites which have conflicting ids.
Remedy : The orphaned sites could cause upgrade failures. Try detach a
nd reattach the database which contains the orphaned sites. R
estart upgrade if necessary.
Category : SiteOrphan
Error : True
UpgradeBlocking : False
Message : Database [W_intranet] contains a site (Id = [46ad6d70-9a5c-4d
e0-8daa-0f73f2466a6a], Url = [/]) whose url is already used b
y a different site, in database (Id = [6063e77c-991f-4c4b-b3a
c-68cb62e66502], name = [w_Internet]), in the same web applic
ation. Consider deleting one of the sites which have conflict
ing urls.
Remedy : The orphaned sites could cause upgrade failures. Try detach a
nd reattach the database which contains the orphaned sites. R
estart upgrade if necessary.
3.2. Performing Post-Upgrade Tasks
The upgrade process is
divided into two components, the content database upgrade and the
visual upgrade. By separating these two components, your SharePoint
team can decide to upgrade the Microsoft Office SharePoint Server 2007
Web application without users noticing the change, because their sites
will maintain the old look and feel. Using the browser, they can
preview what their site looks like with the new SharePoint 2010 look
and feel and then decide when they permanently want to switch to the
visual upgrade. After they make the switch, the browser will not allow
them to switch back to the SharePoint Server 2007 look and feel.
The Set-SPWeb
cmdlet does not have any parameter to help with this task; you will
need to use the properties of the SPWeb object to complete this task.
Type the following commands if you want to switch sites back to the old
look and feel.
Start-SPAssignment -Global
$web = Get-SPWeb http://teams ;
$web.UIVersion = 3;
$web.UIVersionConfigurationEnabled = $true;
$web.Update();
Stop-SPAssignment
Note:
Previously in this article, you created variables to store values and objects. Variable
names are prefixed with the dollar sign, $. In the sample code shown
here, you will see $true
used. This, together with a number of other keywords that look like
variables, is an example of a special variable. A special variable
should be treated as a reserved word that you cannot use in your
scripts to store values or object. The special variable $true represents the value True, $false represents False, $null$_
also has been used in this article and contains the current pipeline
object. It is used in script blocks, filters, and the Where cmdlet. represents null, and
After you run these commands,
the website will revert to the SharePoint Server 2007 look and feel.
The Site Actions button will be in the upper-right corner, for example,
instead of in the upper-left corner. The Site Actions menu will have
the Visual Upgrade option available, although the Visual Upgrade option
at the site collection level may not be enabled. To enable the Visual
Upgrade option at the site collection level, use the following commands.
$site = Get-SPSite http://teams
$site.UIVersionConfigurationEnabled = $true
When updating the
properties of the SPSite object, there is no update method; the changes
to the SPSite properties take effect immediately. You could type the
following line as an alternative to the previous two lines of commands.
(Get-SPSite http://teams).UIVersionConfigurationEnabled = $false
To reset all “team”
websites within a site collection back to the SharePoint Server 2007
look and feel, use the following command.
PS C:\Users\zzspfarm> Get-SPsite http://teams |
>> Get-SPWeb -Filter {$_.Template -eq "STS#0}|
>> ForEach-Object {
>> $_.UIVersion =3;
>> $_.UIVersionConfigurationEnabled = $false;
>> $_.Update();
>> }
>><ENTER>
Note:
These commands also can be run
on a site or site collection that has not been upgraded—that is, on a
site that was created as a version 4 site, thereby making a SharePoint
2010 site look like a SharePoint 2007 site.